package com.lcq.study.javabase;

import java.util.Date;
import java.util.function.BiFunction;
import java.util.function.Function;

/**
 * @ClassName FuncInterfaceTest
 * @Description
 * @Author lichuanqi
 * @Date 2021/11/18 14:33
 * @Version 1.0
 **/
public class FuncInterfaceTest {
    public static void main(String[] args) {
        String name="李四";
        int i=1;
        start("张三", FuncInterfaceTest::hello);

        start1(a->hello(name, a));

        start1(a->good(name, i, a));

    }

    public static <T,K> void start(
            T arg1,
            BiFunction<T, Date, K> execFunction){
        System.out.println(execFunction.apply(arg1, new Date()));
    }

    public static <T,K> void start1(
            Function<Date, K> execFunction){
        System.out.println(execFunction.apply(new Date()));
    }

    public static String hello(String u1, Date date){
        return "hello:"+u1+","+date.toString();
    }

    public static String hi(String u1, Date date){
        return "hi:"+u1+","+date.toString();
    }

    public static String good(String u1, int i, Date date){
        return "good:"+u1+","+date.toString()+i;
    }
}
